<?php /* Smarty version Smarty-3.1.8, created on 2012-11-05 23:00:58
         compiled from "D:\personalweb\personal\tomatoframework\tomatocli/template\resource.class.tpl" */ ?>
<?php /*%%SmartyHeaderCode:163515097d4aae3c445-08817801%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'da0bf0886566f3e87126ee4e082113a00bd9456a' => 
    array (
      0 => 'D:\\personalweb\\personal\\tomatoframework\\tomatocli/template\\resource.class.tpl',
      1 => 1352122291,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '163515097d4aae3c445-08817801',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'resourceName' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_5097d4aae8ef97_24146121',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5097d4aae8ef97_24146121')) {function content_5097d4aae8ef97_24146121($_smarty_tpl) {?><<?php ?>?php

/*
 * Tomato Framework
 * 
 * Copyright 2012-2012 Luax.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * @link http://www.tomatoframework.com
 * @link http://www.luaxlou.com
 * @version $Id$
 */

/**
 * 
 * 
 * @package tomatoframework
 * @author Luax <luaxcn@gmail.com>
 */
class <?php echo ucfirst($_smarty_tpl->tpl_vars['resourceName']->value);?>
Resource {

    /**
     * 
     * @var <?php echo ucfirst($_smarty_tpl->tpl_vars['resourceName']->value);?>
Service
     */
    public $<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service;

    public function _list() {

        return array('<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
s' => $this-><?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service->findAll());
    }

    public function _show($id) {

       

        return array(
            '<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
' => $this-><?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service->find($id),
        );
    }

    public function _edit($id) {


        return array(
            '<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
' => $this-><?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service->find($id)
        );
    }

    public function _create() {


        $<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
 = load::entity(<?php echo ucfirst($_smarty_tpl->tpl_vars['resourceName']->value);?>
Dao::$columns, $_POST);


        return array(
            '<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
' => $<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>

        );
    }

    public function _save() {

        $<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
 = load::entity(<?php echo ucfirst($_smarty_tpl->tpl_vars['resourceName']->value);?>
Dao::$columns, $_POST);

        return $this-><?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service->save($<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
);
    }

    public function _update($id) {

        $<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
 = array_intersect_key($_POST, <?php echo ucfirst($_smarty_tpl->tpl_vars['resourceName']->value);?>
Dao::$columns);
        $<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
['id'] = $id;

        return $this-><?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service->update($<?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
);
    }

    public function _delete($id) {

        return $this-><?php echo $_smarty_tpl->tpl_vars['resourceName']->value;?>
Service->delete($id);
    }

}

?<?php ?>><?php }} ?>